#ifndef SECUREDATAMAPITEM_H
#define SECUREDATAMAPITEM_H
#include "botan/secmem.h"
#include "ciphermanager.h"
#include <QString>

namespace crypto {
class SecureDataMapItem
{
public:
	SecureDataMapItem();

	SecureDataMapItem(QString service_name, QString login, const Botan::secure_vector<uint8_t> &password,
	                  const Botan::secure_vector<uint8_t> &notes, const std::weak_ptr<cipherManager> &manager);

	SecureDataMapItem(const std::string &service_name, const std::string &login, const Botan::secure_vector<uint8_t> &password,
	                  const Botan::secure_vector<uint8_t> &notes, const std::weak_ptr<cipherManager> &manager);

	SecureDataMapItem(const std::string& data, std::weak_ptr<cipherManager> manager);

	SecureDataMapItem(const SecureDataMapItem& item);

	QString getDecryptedData(utils::DataType type) const;

	std::string getEncryptedData(utils::DataType type) const;

	void setDecryptedData(utils::DataType type, const QString& el);

	void setEncryptedData(utils::DataType type, const Botan::secure_vector<uint8_t>& el);

	void setManager(const std::weak_ptr<cipherManager> &manager);

	void clear();

	void reDecryptData(const Botan::InitializationVector& newIv);

	bool empty() const;
private:
	QString _service_name;
	QString _login;
	Botan::secure_vector<uint8_t> _password;
	Botan::secure_vector<uint8_t> _notes;
	std::weak_ptr<cipherManager> _manager;
	bool _isEmpty;
};

std::string to_string(const SecureDataMapItem& item);
}
#endif // SECUREDATAMAPITEM_H
